
package managedbean.SaleLead;

import entity.LineItem;
import entity.SaleInquiry;
import entity.SaleLead;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import session.stateless.SaleInquiryBeanLocal;


@ManagedBean(name="viewSaleLeadsInquiries")
@ViewScoped
public class ViewSaleLeadsInquiries implements Serializable{

    public ViewSaleLeadsInquiries() {
    }
    
    @EJB
    private SaleInquiryBeanLocal saleInquiryBeanLocal;
    private SaleLead selectedSaleLead;
    private List<SaleInquiry> selectedSaleInquiries;
    private List<LineItem> lineItems;
    private String statusMessage;
    
    public void initView(PhaseEvent event)
    {
        selectedSaleLead = (SaleLead)FacesContext.getCurrentInstance().getExternalContext().getFlash().get("selectedSaleLead");            
        selectedSaleInquiries = saleInquiryBeanLocal.getSaleInquiriesBySaleLead(selectedSaleLead.getRegistrationNumber());
    }

    public SaleLead getSelectedSaleLead() {
        return selectedSaleLead;
    }

    public void setSelectedSaleLead(SaleLead selectedSaleLead) {
        this.selectedSaleLead = selectedSaleLead;
    }

    public SaleInquiryBeanLocal getSaleInquiryBeanLocal() {
        return saleInquiryBeanLocal;
    }

    public void setSaleInquiryBeanLocal(SaleInquiryBeanLocal saleInquiryBeanLocal) {
        this.saleInquiryBeanLocal = saleInquiryBeanLocal;
    }

    public List<SaleInquiry> getSelectedSaleInquiries() {
        return selectedSaleInquiries;
    }

    public void setSelectedSaleInquiries(List<SaleInquiry> selectedSaleInquiries) {
        this.selectedSaleInquiries = selectedSaleInquiries;
    }

    public String getStatusMessage() {
        return statusMessage;
    }

    public void setStatusMessage(String statusMessage) {
        this.statusMessage = statusMessage;
    }

    public List<LineItem> getLineItems() {
        return lineItems;
    }

    public void setLineItems(List<LineItem> lineItems) {
        this.lineItems = lineItems;
    }
    
    public List<SaleInquiry> getSaleInquiry(){
        return saleInquiryBeanLocal.getSaleInquiries();
    }

}